﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DBXml;

namespace DBXmlTest
{
    [TestClass]
    public class SortTest
    {
        [TestMethod]
        public void TestSelectionSort()
        {
            string[] myInts = { "this", "is", "a", "test", "of", "generic", "selection", "sort" };
            string[] expected = { "a", "generic", "is", "of", "selection", "sort", "test", "this" };

            Sort<string> mySort = new Sort<string>();
            string[] actual = mySort.SelectionSort(myInts);

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }

        [TestMethod]
        public void TestSelectionSortAlphanum()
        {
            string[] myInts = { "100F", "50F", "SR100", "SR9" };
            string[] expected = { "50F", "100F", "SR9", "SR100" };

            Sort<string> mySort = new Sort<string>();
            string[] actual = mySort.SelectionSort(myInts, 0, myInts.Length, new AlphanumComparatorFast().Compare);

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }

        //[TestMethod]
        //public void TestHeapSort()
        //{
        //    string[] myInts = { "this", "is", "a", "test", "of", "generic", "heap", "sort" };
        //    string[] expected = { "a", "generic", "heap", "is", "of", "sort", "test", "this" };

        //    Sort<string> mySort = new Sort<string>();
        //    string[] actual = mySort.HeapSort(myInts);

        //    for (int i = 0; i < expected.Length; i++)
        //    {
        //        Assert.AreEqual(expected[i], actual[i]);
        //    }
        //}

        //[TestMethod]
        //public void TestHeapSortAlphanum()
        //{
        //    string[] myInts = { "100F", "50F", "SR100", "SR9" };
        //    string[] expected = { "50F", "100F", "SR9", "SR100" };

        //    Sort<string> mySort = new Sort<string>();
        //    string[] actual = mySort.HeapSort(myInts, 0, myInts.Length, new AlphanumComparatorFast().Compare);

        //    for (int i = 0; i < expected.Length; i++)
        //    {
        //        Assert.AreEqual(expected[i], actual[i]);
        //    }
        //}

    }
}
